function Ajax(type, url, data) {
    var jax = null;
    if (window.XMLHttpRequest) {
        jax = new XMLHttpRequest(); //其他浏览器
    } else {
        jax = new ActiveXObject('Microsoft.XMLHTTP'); //ie浏览器
    }

    if (type == 'GET') {
        if (data) {  //判断是否传入data参数
            jax.open('GET', url + '?' + data, true)
        } else {
            jax.open('GET', url, true)
        }
        jax.send();
    } else {
        jax.open('POST', url, true);
        jax.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
        jax.send(data);
    }
    return new Promise(function (resolve, reject) {
        jax.onreadystatechange = function () {
            if (jax.readyState == 4 && jax.status == 200) {
                resolve(jax.responseText);
            }
        }
    })
}